<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button type="button" onclick="refresh()">刷新</button>
<span id="s1"></span>
<a href="02-BOM之History.html">去到02页面</a>
<script>
    console.log(location);
    // 自动跳转到百度
    // location.href = "http://www.baidu.com"
    // 如何实现倒计时跳转
    let time = 3;
    setInterval(function () {
        if (time > 0)
            document.querySelector("#s1").innerHTML = `${time}秒之后，自动跳转到<a href="http://www.baidu.com">百度</a>`
        else
            // location.href = "http://www.baidu.com"
            // location.replace("http://www.baidu.com");
            window.close();//关闭页面

        time--;

    }, 1000)

    function refresh() {
        location.reload();
    }
</script>
</body>
</html>